package com.ny.demo.proo;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        Employee employee1=new Employee();
        employee1.setNumber("1001");
        employee1.setName("哎哎");
        employee1.setAge(19);


        Employee employee2=new Employee();
        employee2.setNumber("1002");
        employee2.setName("欧欧");
        employee2.setAge(20);

        Employee employee3=new Employee();
        employee3.setNumber("1003");
        employee3.setName("妮妮");
        employee3.setAge(21);


       TestList testlist = new TestList();
        List<Employee> list=new ArrayList();
        //调用addEmployee 给list添加员工
        testlist.addEmployee(list,employee1);
        testlist.addEmployee(list,employee2);
        testlist.addEmployee(list,employee3);
        System.out.println(list);
        //调用findallemp，查询所有员工
       testlist.findAllEmployee(list);
        //findempname，根据工号查询

        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入要查询的员工工号：");
        Employee employee=testlist.findEmployeeNumber(list,scanner.next());
        System.out.println(employee);

       //deleteEmployeeNumber根据员工编号进行删除
        System.out.println("请输入你要删除的员工编号");

        String number = scanner.next();

        testlist.deleteEmployeeNumber(list, number);
        //根据员工编号修改某个员工信息，例如10001的年龄修改成20
        System.out.println("请输入要修改的员工编号");
        String updateEmNumber = scanner.next();

        Employee updateEmployee= testlist.findEmployeeNumber(list,updateEmNumber);
        System.out.println("请输入要修改的员工年龄");
        int updateAge= scanner.nextInt();
        updateEmployee.setAge(updateAge);

        testlist.updateEmployee(list,updateEmployee);


    }
}
